<?php

// No direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

/**
* liniocsv controller Class for linio Component
* 
* @package    joomla.administrator.components.linio.controllers
* @subpackage components
* @author MAVLSoft - joomla! Component Creator 1.0
* @version 1.0
* @link http://www.mavlsoft.com/joomlacreator
* @license GNU General Public License version 3 or later; see http://www.gnu.org/copyleft/gpl.html
*/
class linioControllerliniocsv extends linioController
{
	/**
	* constructor (registers additional tasks to methods)
	* @return void
	*/
	function __construct()
	{
		parent::__construct();
	
		// Register Extra tasks
		$this->registerTask( 'add', 'edit' );
	}

	/**
	 * Display Table
	 * @see trackerController::display()
	 */
	function display(){
		JRequest::setVar( 'view', 'liniocsv' );
		parent::display();
	}

	/**
	* display the edit form
	* @return void
	*/
	function edit()
	{
		JRequest::setVar( 'view', 'liniocsv' );
		JRequest::setVar( 'layout', 'form'  );
		JRequest::setVar( 'hidemainmenu', 1 );
	
		parent::display();
	}

	/**
	* save a record (and redirect to main page)
	* @return void
	*/
	function save()
	{
		$model = $this->getModel('liniocsv');
	
		if ($model->store()) {
			$msg = JText::_( 'Record Saved!' );
		} else {
			$msg = JText::_( 'Error Saving Record' );
		}
	
		// Check the table in so it can be edited.... we are done with it anyway
		$link = 'index.php?option=com_linio&controller=liniocsv';
		$this->setRedirect($link, $msg);
	}

	/**
	* remove record(s)
	* @return void
	*/
	function remove()
	{
		$model = $this->getModel('liniocsv');
		if(!$model->delete()) {
			$msg = JText::_( 'Error: One or More Records Could not be Deleted' );
		} else {
			$msg = JText::_( 'Record(s) Deleted' );
		}
	 
		$this->setRedirect( 'index.php?option=com_linio&controller=liniocsv', $msg );
	}

	/**
	* cancel editing a record
	* @return void
	*/
	function cancel()
	{
		$msg = JText::_( 'Operation Cancelled' );
		$this->setRedirect( 'index.php?option=com_linio&controller=liniocsv', $msg );
	}

}
?>